<template>
  <div class="acceleration-details">
    <div class="header">
      <span class="back-btn" @click="goBack"><i class="el-icon-arrow-left"></i>加速值明细</span>
      <div class="header-right">
        <el-dropdown trigger="click">
          <span class="el-dropdown-link">
            <i class="el-icon-setting"></i>
          </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item>退出</el-dropdown-item>
            <el-dropdown-item>关闭</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </div>
    </div>
    <div class="content">
      <div class="current-acceleration">
        当前加速值: <span class="value">{{ this.quickenPoint}}</span>
      </div>

      <el-table
          :data="tableData"
          border
          style="width: 100%">
        <el-table-column
            prop="activity"
            label="活动">
        </el-table-column>

        <el-table-column
            prop="changedValue"
            label="加速值">
          <template slot-scope="scope">
            <span v-if="scope.row.activity ==='每日签到'">+10</span>
            <span v-if="scope.row.activity ==='邀请好友'">+20</span>
            <span v-if="scope.row.activity ==='公众号推广'">-800</span>
            <span v-if="scope.row.activity ==='微博推广'">-1500</span>
          </template>
        </el-table-column>


        <el-table-column
            prop="createTime"
            label="变更时间">
        </el-table-column>
      </el-table>


    </div>
  </div>
</template>

<script>
  let url = 'http://localhost:9701/web/';
export default {
  data() {
    return {
      currentAcceleration: 0,
      quickenPoint:'',
      tableData:[],
    };
  },
  created() {
    this.findUser();
    this.getChargeRecordInfo();
  },
  methods: {
    findUser() {
      this.axios.get(url+'user-account/getUserAccount').then(res=>{
        this.quickenPoint = res.data.data;
      })
    },
    getChargeRecordInfo() {
      this.axios.post(url+'charge-record/getChargeRecordInfo').then(res=>{
        this.tableData = res.data.data;
      })
    },
    goBack() {
      // 这里可以实现返回上一页的逻辑
      this.$router.go(-1);
    },
  },
};
</script>

<style scoped>
.acceleration-details {
  padding: 20px;
  width: 390px;
  margin: 0 auto;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.back-btn {
  font-size: 16px;
  cursor: pointer;
}

.header-right {
  display: flex;
  align-items: center;
}

.header-right.el-dropdown {
  margin-left: 10px;
}

.content {
  background-color: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.current-acceleration {
  font-size: 18px;
  margin-bottom: 20px;
}

.value {
  font-weight: bold;
  color: #ff6600;
}

</style>